import { Controller, Post, Body, Get } from '@nestjs/common'
import { Prisma } from '@prisma/client'
import { ShopService } from './shop.service'

@Controller('shop')
export class ShopController {
  constructor(private readonly shopService: ShopService) {}

  @Post()
  async createShop(@Body() data: Prisma.ShopCreateInput) {
    const shop = await this.shopService.createAndUpdateShop(data)
    return {
      statusCode: 200,
      message: 'OK',
      data: {
        shop
      }
    }
  }

  @Get()
  async getShop() {
    const shop = await this.shopService.getShop()
    return {
      statusCode: 200,
      message: 'OK',
      data: {
        shop
      }
    }
  }
}
